import os
import yaml
from shutil import copyfile
path='default.yaml'
with open(path, 'r') as f:
    cfg = yaml.load(f, Loader=yaml.Loader)
if not os.path.exists( cfg['folder']):     #判断当前路径是否存在，没有则创建new文件夹
    os.makedirs(cfg['folder'])


if __name__ == "__main__":
    try:
        targetfolder=cfg['folder']+'/'+cfg['dataset']+'.yaml'
        copyfile(path,targetfolder )
    except:
        pass
    cmd1='nohup python -u training.py >> '+cfg['folder']+'/'+cfg['cmd']
    os.system(cmd1)
    
    # /home/kaixin/code/time/run.py